package com.baitiaojun.common.exception;

/**
 * 异常抽象接口
 */
public abstract class GlobalException extends RuntimeException {
    
    private Integer code;
    
    private String message;

    public GlobalException() {
    }

    public GlobalException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.message = errorCode.getMessage();
    }

    public GlobalException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public GlobalException setCode(Integer code) {
        this.code = code;
        return this;
    }

    public GlobalException setMessage(String message) {
        this.message = message;
        return this;
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
